package cn.tedu.store.temperatureDetection.service.impl;

import cn.tedu.store.temperatureDetection.entity.dto.NucleicDto;
import cn.tedu.store.temperatureDetection.mapper.FuYouNucleicMapper;
import cn.tedu.store.temperatureDetection.mapper.JiKongNucleicMapper;
import cn.tedu.store.temperatureDetection.mapper.PeopleNucleicMapper;
import cn.tedu.store.temperatureDetection.mapper.ZhongYiNucleicMapper;
import cn.tedu.store.temperatureDetection.service.NucleicService;
import cn.tedu.store.util.NucleicQuery;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 75936
 * @version 1.0
 * @project demo_hesuan
 * @description
 * @date 2022-12-14 09:33:48
 */
@Service
public class NucleicServiceImpl  implements NucleicService {
    @Resource
    PeopleNucleicMapper peopleNucleicMapper;
    @Resource
    FuYouNucleicMapper fuYouNucleicMapper;
    @Resource
    JiKongNucleicMapper jiKongNucleicMapper;
    @Resource
    ZhongYiNucleicMapper zhongYiNucleicMapper;
    @Override
    public NucleicDto findPeopleNucleicCount(NucleicQuery nucleicQuery) {
        /**妇幼的数据**/
        Long fuYouNucleicCount = fuYouNucleicMapper.findFuYouNucleicCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        Long fuYouNucleicNegativeCount = fuYouNucleicMapper.findFuYouNucleicNegativeCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        Long fuYouNucleicPositiveCount = fuYouNucleicMapper.findFuYouNucleicPositiveCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        /**疾控的数据**/
        Long jiKongNucleicCount = jiKongNucleicMapper.findJiKongNucleicCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        Long jiKongNucleicNegativeCount = jiKongNucleicMapper.findJiKongNucleicNegativeCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        Long jiKongNucleicPositiveCount = jiKongNucleicMapper.findJiKongNucleicPositiveCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        /**中医的数据**/
        Long zhongYiNucleicCount = zhongYiNucleicMapper.findZhongYiNucleicCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        Long zhongYiNucleicNegativeCount = zhongYiNucleicMapper.findZhongYiNucleicNegativeCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());
        Long zhongYiNucleicPositiveCount = zhongYiNucleicMapper.findZhongYiNucleicPositiveCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime());

        NucleicDto nucleicDto = new NucleicDto();
        nucleicDto.setNucleicCount(peopleNucleicMapper.findPeopleNucleicCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime())+fuYouNucleicCount+jiKongNucleicCount+zhongYiNucleicCount);
        nucleicDto.setNucleicNegativeCount(peopleNucleicMapper.findNucleicNegativeCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime())+fuYouNucleicNegativeCount+jiKongNucleicNegativeCount+zhongYiNucleicCount);
        nucleicDto.setNucleicPositiveCount(peopleNucleicMapper.findNucleicPositiveCount(nucleicQuery.getStartTime(), nucleicQuery.getEndTime())+fuYouNucleicPositiveCount+jiKongNucleicPositiveCount+zhongYiNucleicPositiveCount);
        return nucleicDto;
    }


}
